home *** CD-ROM | disk | FTP | other *** search
/ Amiga Game-Power / Amiga Game-Power.iso / anwendungen / gw print / structurebrowser_v1.3 / sources / sbwindow.c < prev    next >
C/C++ Source or Header  |  1994-05-20  |  9KB  |  273 lines

  1. /*
  2.    Handles the Intuition Window structure
  3.  
  4.    Not implemented:
  5.       Window.Pointer
  6.       Window.UserPort
  7.       Window.WindowPort
  8.       Window.MessageKey
  9.       Window.ExtData
  10.       Window.UserData
  11. */
  12.  
  13. #include "header/sb.h"
  14.  
  15. extern int level;         /* recursion level */
  16.  
  17.  
  18. /* PrWindow
  19.  
  20.    Put up the first page of data for a Window structure.
  21. */
  22.  
  23. PrWindow (string, window)
  24. char *string;
  25. struct Window *window;
  26. {
  27. static struct StructData structdata[] = {
  28.    { " NextWindow",   "struct Window *",     PRPTR,      PTRSIZE },
  29.    { "-LeftEdge",     "SHORT",               PRINT,      INTSIZE },
  30.    { "-TopEdge",      "SHORT",               PRINT,      INTSIZE },
  31.    { "-Width",        "SHORT",               PRINT,      INTSIZE },
  32.    { "-Height",       "SHORT",               PRINT,      INTSIZE },
  33.    { "-MouseY",       "SHORT",               PRINT,      INTSIZE },
  34.    { "-MouseX",       "SHORT",               PRINT,      INTSIZE },
  35.    { "-MinWidth",     "SHORT",               PRINT,      INTSIZE },
  36.    { "-MinHeight",    "SHORT",               PRINT,      INTSIZE },
  37.    { "-MaxWidth",     "SHORT",               PRINT,      INTSIZE },
  38.    { "-MaxHeight",    "SHORT",               PRINT,      INTSIZE },
  39.    { " Flags",        "ULONG",               PRULONG,    PTRSIZE },
  40.    { " MenuStrip",    "struct Menu *",       PRPTR,      PTRSIZE },
  41.    { " Title",        "UBYTE *",             PRSTRING,   PTRSIZE },
  42.    { " FirstRequest", "struct Requester *",  PRPTR,      PTRSIZE },
  43.    { " DMRequest",    "struct Requester *",  PRPTR,      PTRSIZE }
  44. };
  45.  
  46. static char *flagnames[32] = {
  47.    "WINDOWSIZING",   "WINDOWDRAG",    "WINDOWDEPTH",    "WINDOWCLOSE",
  48.    "SIZEBRIGHT",     "SIZEBBOTTOM",   "SIMPLE_REFRESH", "OTHER_REFRESH",
  49.    "BACKDROP",       "REPORTMOUSE",   "GIMMEZEROZERO",  "BORDERLESS",
  50.    "ACTIVATE",       "WINDOWACTIVE",  "INREQUEST",      "MENUSTATE",
  51.    "RMBTRAP",        "NOCAREREFRESH", NULL,             NULL,
  52.    NULL,             NULL,            NULL,             NULL,
  53.    "WINDOWREFRESH",  "WBENCHWINDOW",  "WINDOWTICKED"
  54. };
  55.  
  56. int i, sum;
  57. int choice = -1;
  58. ULONG bits;
  59.  
  60.    level++;
  61.  
  62.    while (choice)
  63.    {
  64.       sum = SetOptionText(string, structdata, (APTR)window, DATASIZE, 0);
  65.  
  66.       switch (choice = GetChoice(MAXGADG + 1))
  67.       {
  68.          case 1:
  69.             if (window->NextWindow)
  70.                PrWindow("The next window in Intuition's list",
  71.                   window->NextWindow);
  72.             break;
  73.          case 12:
  74.             bits = window->Flags & ~SUPER_UNUSED;
  75.             switch ((bits & REFRESHBITS) >> 6)
  76.             {
  77.                case 0:
  78.                   flagnames[6] = "SMART_REFRESH";
  79.                   bits |= 0x40;
  80.                   break;
  81.                case 1:
  82.                   flagnames[6] = "SIMPLE_REFRESH";
  83.                   break;
  84.                case 2:
  85.                   flagnames[7] = "SUPER_BITMAP";
  86.                   break;
  87.                case 3:
  88.                   flagnames[7] = "OTHER_REFRESH";
  89.                   bits ^= 0x40;
  90.                   break;
  91.             }
  92.             FlagPrint("Flags set in this window", flagnames, bits);
  93.             break;
  94.          case 13:
  95.             if (window->MenuStrip)
  96.                PrMenu("This Window's first Menu", window->MenuStrip);
  97.             break;
  98.          case 14:
  99.             PrString("The Window's Title", window->Title);
  100.             break;
  101.          case 15:
  102.             if (window->FirstRequest)
  103.                PrRequester("This Window's first Requester",
  104.                      window->FirstRequest);
  105.             break;
  106.          case 16:
  107.             if (window->DMRequest)
  108.                PrRequester("The double-click Requester for this Window",
  109.                      window->DMRequest);
  110.             break;
  111.          case MOREGADG:
  112.             PrWindow2("Window members (page 2)", window, sum);
  113.             break;
  114.       }
  115.    }
  116.    level--;
  117. }
  118.  
  119.  
  120. /* PrWindow2
  121.  
  122.    Put up the second page of data for a Window structure.
  123. */
  124.  
  125. PrWindow2 (string, window, offset)
  126. char *string;
  127. struct Window *window;
  128. int offset;
  129. {
  130. static struct StructData structdata[] = {
  131.    { "-ReqCount",     "SHORT",               PRINT,   INTSIZE  },
  132.    { " WScreen",      "struct Screen *",     PRPTR,   PTRSIZE  },
  133.    { " RPort",        "struct RastPort *",   PRPTR,   PTRSIZE  },
  134.    { "-BorderLeft",   "BYTE",                PRBYTE,  BYTESIZE },
  135.    { "-BorderTop",    "BYTE",                PRBYTE,  BYTESIZE },
  136.    { "-BorderRight",  "BYTE",                PRBYTE,  BYTESIZE },
  137.    { "-BorderBottom", "BYTE",                PRBYTE,  BYTESIZE },
  138.    { " BorderRPort",  "struct RastPort *",   PRPTR,   PTRSIZE  },
  139.    { " FirstGadget",  "struct Gadget *",     PRPTR,   PTRSIZE  },
  140.    { " Parent",       "struct Window *",     PRPTR,   PTRSIZE  },
  141.    { " Descendant",   "struct Window *",     PRPTR,   PTRSIZE  },
  142.    { "(Pointer",      "USHORT *)",           PRPTR,   PTRSIZE  },
  143.    { "-PtrHeight",    "BYTE",                PRBYTE,  BYTESIZE },
  144.    { "-PtrWidth",     "BYTE",                PRBYTE,  BYTESIZE },
  145.    { "-XOffset",      "BYTE",                PRBYTE,  BYTESIZE },
  146.    { "-YOffset",      "BYTE",                PRBYTE,  BYTESIZE }
  147. };
  148.  
  149. int i, sum;
  150. int choice = -1;
  151.  
  152.    level++;
  153.  
  154.    while (choice)
  155.    {
  156.       sum = SetOptionText(string, structdata,
  157.             (APTR)window, DATASIZE, offset);
  158.  
  159.       switch (choice = GetChoice(MAXGADG + 1))
  160.       {
  161.          case 2:
  162.             if (window->WScreen)
  163.                PrScreen("The screen referenced in the window structure",
  164.                   window->WScreen);
  165.             break;
  166.          case 3:
  167.             if (window->RPort)
  168.                PrRastPort("The window's RPort (RastPort)", window->RPort);
  169.             break;
  170.          case 8:
  171.             if (window->BorderRPort)
  172.                PrRastPort("The window's BorderRPort", window->BorderRPort);
  173.             break;
  174.          case 9:
  175.             if (window->FirstGadget)
  176.                PrGadget("The window's first gadget", window->FirstGadget);
  177.             break;
  178.          case 12:
  179.             printf("Sorry, selection not implemented\n\n");
  180.             break;
  181.          case 10:
  182.             if (window->Parent)
  183.                PrWindow("The `parent' window", window->Parent);
  184.             break;
  185.          case 11:
  186.             if (window->Descendant)
  187.                PrWindow("The `descendant' window", window->Descendant);
  188.             break;
  189.          case MOREGADG:
  190.             PrWindow3("Window members (page 3)", window, sum);
  191.             break;
  192.       }
  193.    }
  194.    level--;
  195. }
  196.  
  197.  
  198. /* PrWindow3
  199.  
  200.    Put up the third page of data for a Window structure.
  201. */
  202.  
  203. PrWindow3 (string, window, offset)
  204. char *string;
  205. struct Window *window;
  206. int offset;
  207. {
  208. static struct StructData structdata[] = {
  209.    { " IDCMPFlags",   "ULONG",                   PRLONG,    PTRSIZE  },
  210.    { "(UserPort",     "struct MsgPort *)",       PRPTR,     PTRSIZE  },
  211.    { "(WindowPort",   "struct MsgPort *)",       PRPTR,     PTRSIZE  },
  212.    { "(MessageKey",   "struct IntuiMessage *)",  PRPTR,     PTRSIZE  },
  213.    { "-DetailPen",    "UBYTE",                   PRUBYTE,   BYTESIZE },
  214.    { "-BlockPen",     "UBYTE",                   PRUBYTE,   BYTESIZE },
  215.    { " CheckMark",    "struct Image *",          PRPTR,     PTRSIZE  },
  216.    { " ScreenTitle",  "UBYTE *",                 PRSTRING,  PTRSIZE  },
  217.    { "-GZZMouseX",    "SHORT",                   PRINT,     INTSIZE  },
  218.    { "-GZZMouseY",    "SHORT",                   PRINT,     INTSIZE  },
  219.    { "-GZZWidth",     "SHORT",                   PRINT,     INTSIZE  },
  220.    { "-GZZHeight",    "SHORT",                   PRINT,     INTSIZE  },
  221.    { "(ExtData",      "UBYTE *)",                PRPTR,     PTRSIZE  },
  222.    { "(UserData",     "BYTE *)",                 PRPTR,     PTRSIZE  },
  223.    { " WLayer",       "struct Layer *",          PRPTR,     PTRSIZE  }
  224. };
  225.  
  226. static char *IDCMPnames[32] = {
  227.    "SIZEVERIFY",     "NEWSIZE",       "REFRESHWINDOW",  "MOUSEBUTTONS",
  228.    "MOUSEMOVE",      "GADGETDOWN",    "GADGETUP",       "REQSET",
  229.    "MENUPICK",       "CLOSEWINDOW",   "RAWKEY",         "REQVERIFY",
  230.    "REQCLEAR",       "MENUVERIFY",    "NEWPREFS",       "DISKINSERTED",
  231.    "DISKREMOVED",    "WBENCHMESSAGE", "ACTIVEWINDOW",   "INACTIVEWINDOW",
  232.    "DELTAMOVE",      "VANILLAKEY",    "INTUITICKS",     NULL,
  233.    NULL,             NULL,            NULL,             NULL,
  234.    NULL,             NULL,            NULL,             "LONELYMESSAGE"
  235. };
  236.  
  237. int i, sum;
  238. int choice = -1;
  239.  
  240.    level++;
  241.  
  242.    while (choice)
  243.    {
  244.       sum = SetOptionText(string, structdata,
  245.             (APTR)window, DATASIZE, offset);
  246.  
  247.       switch (choice = GetChoice(DATASIZE))
  248.       {
  249.          case 1:
  250.             FlagPrint("IDCMP flags set in this window",
  251.                   IDCMPnames, window->IDCMPFlags);
  252.             break;
  253.          case 7:
  254.             if (window->CheckMark)
  255.                PrImage("The CheckMark Image for this Window",
  256.                      window->CheckMark);
  257.             break;
  258.          case 8:
  259.             PrString("The screen title when this window is activated",
  260.                      window->ScreenTitle);
  261.             break;
  262.          case 15:
  263.             if (window->WLayer)
  264.                PrLayer("The Layer for this Window", window->WLayer);
  265.             break;
  266.       }
  267.    }
  268.    level--;
  269. }
  270.  
  271.  
  272.  
  273.